package com.maimao.core.model.auth;

import lombok.*;

/**
 * 认证通过的用户实体 资源服务器解析jwt信息封装为此
 *
 * @author MaoLin Wang
 * @date 2020/12/2 2:56 下午
 */
@Setter
@Getter
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class AuthUser {

    private String id;

    private Long shopId;

    private String username;

    private String realName;

    private String avatar;

    private String type;

    private String role;

    /**
     * 前端是否需要连接webSocket 拥有审核权限的管理员需要登录后连接webSocket
     */
    private Boolean connectWebSocket;

    public Long getId2Long() {
        return id == null ? null : Long.valueOf(id);
    }

    @Override
    public String toString() {
        return "AuthUser{" +
                "id='" + id + '\'' +
                ", shopId=" + shopId +
                ", username='" + username + '\'' +
                ", realName='" + realName + '\'' +
                ", avatar='" + avatar + '\'' +
                ", type='" + type + '\'' +
                ", role='" + role + '\'' +
                ", connectWebSocket=" + connectWebSocket +
                '}';
    }
}
